<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /**
       * @param {number[]} heights
       * @return {number}
       */
      var heightChecker = function (heights) {
        let count = 0;
        let sort = [];
        sort = Object.assign(sort, heights);
        sort.sort((a, b) => a - b);
        for (let key in heights) {
          if (heights[key] !== sort[key]) {
            count++;
          }
        }
        return count;
      };
    </script>
  </body>
</html>
